<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Construct</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="reflectionparameter.clone.html">ReflectionParameter::__clone</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="reflectionparameter.export.html">ReflectionParameter::export</a></div>
 <div class="up"><a href="class.reflectionparameter.html">ReflectionParameter</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="reflectionparameter.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionParameter::__construct</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">ReflectionParameter::__construct</span> &mdash; <span class="dc-title">Construct</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionparameter.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ReflectionParameter::__construct</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$function</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$parameter</code></span>
   )</div>

  <p class="para rdfs-comment">
   Constructs a <a href="class.reflectionparameter.html" class="classname">ReflectionParameter</a> class.
  </p>

  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">本函数还未编写文档，仅有参数列表。</p></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionparameter.construct-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">function</code></em></dt>

     <dd>

      <p class="para">
       The function to reflect parameters from.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">parameter</code></em></dt>

     <dd>

      <p class="para">
       The parameter.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-reflectionparameter.construct-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-reflectionparameter.construct-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5139">
    <p><strong>Example #1 Using the <a href="class.reflectionparameter.html" class="classname">ReflectionParameter</a> class</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">)&nbsp;{&nbsp;}<br />function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">(</span><span style="color: #0000BB">Exception&nbsp;$a</span><span style="color: #007700">,&nbsp;&amp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">)&nbsp;{&nbsp;}<br />function&nbsp;</span><span style="color: #0000BB">baz</span><span style="color: #007700">(</span><span style="color: #0000BB">ReflectionFunction&nbsp;$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">)&nbsp;{&nbsp;}<br />function&nbsp;</span><span style="color: #0000BB">abc</span><span style="color: #007700">()&nbsp;{&nbsp;}<br /><br /></span><span style="color: #0000BB">$reflect&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">ReflectionFunction</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #0000BB">$reflect</span><span style="color: #007700">;<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">$reflect</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getParameters</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$param</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"--&nbsp;Parameter&nbsp;#%d:&nbsp;%s&nbsp;{\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"&nbsp;&nbsp;&nbsp;Class:&nbsp;%s\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"&nbsp;&nbsp;&nbsp;Allows&nbsp;NULL:&nbsp;%s\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"&nbsp;&nbsp;&nbsp;Passed&nbsp;to&nbsp;by&nbsp;reference:&nbsp;%s\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"&nbsp;&nbsp;&nbsp;Is&nbsp;optional?:&nbsp;%s\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"}\n"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">,&nbsp;</span><span style="color: #FF8000">//&nbsp;$param-&gt;getPosition()&nbsp;can&nbsp;be&nbsp;used&nbsp;from&nbsp;PHP&nbsp;5.2.3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$param</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getName</span><span style="color: #007700">(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">$param</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getClass</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">$param</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">allowsNull</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">$param</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isPassedByReference</span><span style="color: #007700">(),&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$param</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isOptional</span><span style="color: #007700">()&nbsp;?&nbsp;</span><span style="color: #DD0000">'yes'&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #DD0000">'no'<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Function [ &lt;user&gt; function foo ] {
  @@ /Users/philip/cvs/phpdoc/a 2 - 2

  - Parameters [3] {
    Parameter #0 [ &lt;required&gt; $a ]
    Parameter #1 [ &lt;required&gt; $b ]
    Parameter #2 [ &lt;required&gt; $c ]
  }
}
-- Parameter #0: a {
   Class: NULL
   Allows NULL: true
   Passed to by reference: false
   Is optional?: no
}
-- Parameter #1: b {
   Class: NULL
   Allows NULL: true
   Passed to by reference: false
   Is optional?: no
}
-- Parameter #2: c {
   Class: NULL
   Allows NULL: true
   Passed to by reference: false
   Is optional?: no
}
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-reflectionparameter.construct-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="reflectionfunction.construct.html" class="methodname" rel="rdfs-seeAlso">ReflectionFunction::__construct()</a> - Constructs a ReflectionFunction object</span></li>
    <li class="member"><span class="methodname"><a href="reflectionmethod.construct.html" class="methodname" rel="rdfs-seeAlso">ReflectionMethod::__construct()</a> - Constructs a ReflectionMethod</span></li>
    <li class="member"><a href="language.oop5.decon.html#language.oop5.decon.constructor" class="link">Constructors</a></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="reflectionparameter.clone.html">ReflectionParameter::__clone</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="reflectionparameter.export.html">ReflectionParameter::export</a></div>
 <div class="up"><a href="class.reflectionparameter.html">ReflectionParameter</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
